nested ternary operator javascript